import http from '../util/index.js'
// login
export const LoginPostData = data => {
  return http.post('/login', data)
}
// 侧边栏
export const AsideMenu = () => {
  return http.get('/menus')
}
// user
export const usermenu = params => {
  return http.get('/users', params)
}
export const changeuserstate = data => {
  return http.put(`/users/${data.id}/state/${data.state}`)
}
export const adduser = data => {
  return http.post('/users', data)
}
export const edituser = params => {
  return http.get('/users/' + params)
}
export const putedituser = (data, data2) => {
  return http.put('/users/' + data, data2)
}
export const deluser = data => {
  return http.delete('/users/' + data)
}
export const setroles = () => {
  return http.get('roles')
}
export const dispathrights = (data, data1) => {
  return http.put('/users/' + data + '/role', data1)
}
// rights
export const getrightslist = params => {
  return http.get('/rights/' + params)
}
// roles
export const getroleslist = () => {
  return http.get('/roles')
}
export const delroles = (data1, data2) => {
  return http.delete('/roles/' + data1 + '/rights/' + data2)
}
export const dispathroles = () => {
  return http.get('/rights/tree')
}
export const addrights = (data, data2) => {
  return http.post('/roles/' + data + '/rights', data2)
}
